home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Games Machine 76
/
XENIATGM66.iso
/
Indiana Jones
/
Indiana Jones.exe
/
RESOURCE
/
PREVIEW.GOB
/
cog_pyr_lightbox.cog
< prev
next >
Wrap
Text File
|
1999-11-15
|
12KB
|
486 lines
# Jones 3D Cog Script
#
# pyr_lightbox.cog
#
# Control lightboxes atop each pyramid
#
# [RKD]
#
# (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
# ========================================================================================
symbols
message startup
message activated
message arrived
message crossed
message user1
# lightbox elements
thing boxside0
thing boxside1 nolink
thing boxside2 nolink
thing eyewall nolink
thing paddle nolink
thing flame nolink
thing flame2 nolink
thing kindling nolink
thing kindlingbox
thing bigbox nolink
# cameras and camera gotos
thing cornercam nolink
thing eyecam nolink
thing cornercamgoto nolink
thing eyecamgoto nolink
# indy and the actors
thing player local
thing indyactor0 nolink
thing indyactor1 nolink
thing indyactor2 nolink
# actor lookthings
thing indylook nolink
# light channel and quadrants of room
sector glowsector nolink
sector beamsector nolink
sector farsector nolink
sector midsector nolink
sector holesector nolink
# surfaces
surface glowface nolink
surface turnitoff
surface turniton
# indy's keyframes
keyframe lightwood=in_light_wood.key local
keyframe handsOnHips=0in_stand4.key local
keyframe handsToHips=0in_stand1_bd_4.key local
# lightbox keyframes
keyframe paddlemove=pyr_padl_swch.key local
keyframe lensfold=pyr_firebx_lens.key local
keyframe sidefold=pyr_firebx_wall.key local
# materials
material flamemat=gen_a4_oil_fire.mat local
# indy's saylines
sound prismeye=pr12j07.wav local
sound anothereye=pr12j08.wav local
sound shaft=pr12j09.wav local
sound prettydry=pr12j10.wav local
sound firewood=pr12j11.wav local
# varous sounds
sound paddlesnd=pyr_lightroom_paddle.wav local
sound rising=pyr_lightbox_rise.wav local
sound stopping=pyr_lightbox_stop.wav local
sound closing=pyr_lightbox_panels.wav local
sound lighttorch=gen_torchlitet_c.wav local
sound burning=pyr_flame_loop.wav local
# music
sound riseup1=mus_pyr_firebig.wav local
sound riseup2=mus_pyr_firesmall.wav local
# variables
vector pyrlight0 local
vector pyrlight1 local
vector pyrlight2 local
vector pyrlight3 local
vector pyrlight4 local
vector torchlight local
int pyrnum=0
int actornum=0 local
int locked=0 local
int curmusic=0 local
int curvoice=0 local
int curactor=0 local
int curanim=0 local
int cursound=0 local
int flamesound=0 local
# subroutines
flex startscene=0.0 local
flex fixcams=0.0 local
flex lightkindling=0.0 local
flex boxrise=0.0 local
end
code
startup:
player = GetLocalPlayerThing();
# establish lighting values for each pyramid
pyrlight0 = VectorSet(0, 0, 0);
pyrlight1 = VectorSet(0.6, 0, 1.5);
pyrlight2 = VectorSet(0, 1.5, 0);
pyrlight3 = VectorSet(1.5, 0, 0);
pyrlight4 = VectorSet(1.5, 1.5, 0);
torchlight = VectorSet(0.87, 0.55, 0.06);
# set kindling to no light, turn flame off
SetThingLight(kindling, pyrlight0, 0.001, 0.01);
SetThingFlags(flame, 0x10);
SetThingFlags(flame2, 0x10);
# start big flame animating
MaterialAnim(flamemat, 10, 1);
# turn off collision on lightbox parts
SetCollideType(boxside0, 0);
SetCollideType(boxside1, 0);
SetCollideType(boxside2, 0);
SetCollideType(eyewall, 0);
SetCollideType(bigbox, 0);
#seal off sight path
SetSectorAdjoins(glowsector, 0);
# global4 represents number of lightboxes that have risen
global4 = 0;
return;
activated:
# ---> kindlingbox (easier to activate than kindling)
# if kindlingbox is not what's activated, or is not there(visible), or is already lit(locked), return
if (locked) return;
if (GetSenderRef() != kindlingbox) return;
if (GetThingFlags(kindling) & 0x10) return;
# if player is somehow standing in the entry sector, exit
if (GetThingSector(player) == holesector) return;
#if player isn't carrying lighter (and not in Marcus) give a hint
if ((GetCurWeapon(player) != 13) && (!InEditor()))
{
# freeze player, start scene
if (MakeMeStop() == -1) return;
DeselectWeaponWait(player);
StartCutscene(1);
SetExtCamOffset('0.07 -0.13 0.13');
sleep(.5);
if (global4 == 0)
{
curvoice = PlayVoice(player, prettydry, 1, 1);
}
else
{
curvoice = PlayVoice(player, firewood, 1, 1);
}
sleep(.5);
RestoreExtCam();
ClearActorFlags(player, 0x200000);
EndCutscene();
return;
}
if (MakeMeStop() == -1) return;
locked = 1;
# increment global4 to vary Indy's reaction each time
global4 = global4 + 1;
# figure out which indyactor to use
if (GetThingSector(player) == beamsector) actornum = 0;
if (GetThingSector(player) == midsector) actornum = 1;
if (GetThingSector(player) == farsector) actornum = 2;
curactor = indyactor0[actornum];
call startscene;
call lightkindling;
sleep(2);
call boxrise;
# make indy put his hands down if they aren't already
StopKey(curactor, curanim, .5);
WaitForSound(curmusic);
call fixcams;
TeleportThing(player, curactor);
SetThingFlags(curactor, 0x80000);
ClearThingFlags(player, 0x80000);
ClearActorFlags(player, 0x200000);
# Establish a camera position near Indy and prep follow-cam...
SetCameraPosition(1, VectorAdd(VectorTransformToOrient(player, '0.25 -0.1 0.0'), GetThingPos(player)));
SetCurrentCamera(1);
# post cutscene, draw glowface again
SetFaceGeoMode(glowface, 4);
# Bring bigbox into play (handles wierdo collision for lightbox)
SetCollideType(bigbox, 3);
EndCutscene();
return;
startscene:
call fixcams;
StartCutscene(1);
CopyPlayerHolsters(player, curactor);
SetActorFlags(player, 0x200000);
TeleportThing(player, curactor);
# change to cornercam
SetCameraFocus(2, cornercam);
SetCameraSecondaryFocus(2, flame);
SetCurrentCamera(2);
SetCameraFOV(90, 0, 0);
return;
lightkindling:
# light kindling, make flame visible
curanim = PlayKey(player, lightwood, 2, 0x14, 0);
Sleep(.5);
# make flames visible, lit up, noisy, and slowly rotating
SetThingLight(flame, torchlight, 0.001, 0.2);
SetThingLight(kindling, torchlight, 0.38, 0.01);
ClearThingFlags(flame, 0x10);
Rotate(flame, 3600, 1, 150);
PlaySoundThing(lighttorch, kindling, 1, 3, 10, 0);
sleep(.1);
SetThingLight(flame2, torchlight, 0.001, 0.4);
ClearThingFlags(flame2, 0x10);
Rotate(flame2, 3600, 1, 75);
flamesound = PlaySoundThing(burning, kindling, 1, 3, 10, 1);
StopKey(player, curanim, 1);
# light up the lightbox parts
SetThingLight(boxside0, torchlight, .001, .5);
SetThingLight(boxside1, torchlight, .001, .5);
SetThingLight(boxside2, torchlight, .001, .5);
SetThingLight(eyewall, torchlight, .001, .5);
# play different music depending on the number of lightboxes raised
if (global4 == 1)
{
curmusic = PlaySoundLocal(riseup1, 1, 0, 0, 0);
}
Sleep(.5);
# change to actor for reaction
DeselectWeaponWait(player);
TeleportThing(curactor, player);
CopyPlayerHolsters(player, curactor);
SetThingFlags(player, 0x80000);
ClearThingFlags(curactor,0x80000);
#make indy look at the flame
AIEnableHeadTracking(curactor, flame);
AIEnableBodyTracking(curactor, flame);
Sleep(.5);
# change cameras
SetCameraPosInterp(2, 1);
SetCameraInterpSpeed(2, 4);
SetCameraFocus(2, cornercamgoto);
SetCameraFOV(100, 1, 4);
# play paddle animation
PlayKey(paddle, paddlemove, 4, 0x4, 0);
PlaySoundThing(paddlesnd, paddle, 1, 3, 10, 0);
sleep(.75);
# if this is the beam sector, keep Indy from moonwalking
if (GetThingSector(player) == beamsector)
{
AIEnableBodyTracking(curactor, indylook);
}
AISetMoveFrame(curactor, 1);
return;
boxrise:
# restore collision to lightbox parts
SetCollideType(boxside0, 3);
SetCollideType(boxside1, 3);
SetCollideType(boxside2, 3);
SetCollideType(eyewall, 3);
# make box parts move up
ChangeSoundVol(flamesound, .1, 3.5);
AttachThingToThing(indylook, eyewall);
MoveToFrame(eyewall, 1, 1);
MoveToFrame(boxside0, 1, 1);
MoveToFrame(boxside1, 1, 1);
MoveToFrame(boxside2, 1, 1);
cursound = PlaySoundThing(rising, eyewall, 1, 3, 10, 0);
# create low-level tint on box parts and make kindling light the room
SetThingLight(eyewall, pyrlight0[pyrnum], 0.001, 6);
SetThingLight(boxside0, pyrlight0[pyrnum], 0.001, 6);
SetThingLight(boxside1, pyrlight0[pyrnum], 0.001, 6);
SetThingLight(boxside2, pyrlight0[pyrnum], 0.001, 6);
SetThingLight(kindling, pyrlight0[pyrnum], 0.38, 6);
sleep(.4);
if (global4 > 2)
{
curanim = PlayKey(curactor, handstohips, 4, 0x12, 1);
curanim = PlayKey(curactor, handsonhips, 4, 0x14, 0);
}
#make indy look at the box
SetThingMaxHeadVel(curactor, 225);
AIEnableHeadTracking(curactor, indylook);
AIEnableBodyTracking(curactor, indylook);
Sleep(1);
# if not the first time, start shorter music here instead
if (global4 != 1)
{
curmusic = PlaySoundLocal(riseup2, 1, 0, 0, 0);
}
if (global4 == 1)
{
Sleep(.5);
ChangeSoundVol(cursound, 0.2, 0.3);
ChangeSoundVol(curmusic, 0.2, 0.3);
PlaySoundLocal(prismeye, 1, 0, 0, 1);
ChangeSoundVol(curmusic, 1, 0.4);
ChangeSoundVol(cursound, 1, 0.4);
}
else if (global4 == 2)
{
Sleep(.1);
ChangeSoundVol(cursound, 0.2, 0.3);
ChangeSoundVol(curmusic, 0.2, 0.3);
PlaySoundLocal(anothereye, 1, 0, 0, 1);
ChangeSoundVol(cursound, 1, 0.4);
ChangeSoundVol(curmusic, 1, 0.4);
}
return;
arrived:
# ---> BoxSide0
cursound = PlaySoundThing(stopping, eyewall, 1, 3, 10, 0);
#fold box after it rises
sleep(.5);
cursound = PlaySoundThing(closing, eyewall, 1, 3, 10, 0);
PlayKey(eyewall, lensfold, 4, 0x14, 0);
PlayKey(boxside0, sidefold, 4, 0x14, 0);
PlayKey(boxside1, sidefold, 4, 0x14, 0);
PlayKey(boxside2, sidefold, 4, 0x14, 0);
SetFaceGeoMode(glowface, 0);
SetCameraInterpSpeed(2, 4);
SetCameraFocus(2, eyecam);
SetCameraFOV(90, 1, 4);
sleep(4);
# pullback speed is different depending on length of music
if (global4 == 1)
{
SetCameraInterpSpeed(2, 7);
}
else
{
SetCameraInterpSpeed(2, 5.25);
}
SetCameraFocus(2, eyecamgoto);
if (global4 == 2)
{
ChangeSoundVol(cursound, 0.2, 0.3);
ChangeSoundVol(curmusic, 0.2, 0.3);
curvoice = PlaySoundLocal(shaft, 1, 0, 0, 1);
ChangeSoundVol(curmusic, 1, 0.4);
ChangeSoundVol(cursound, 1, 0.4);
}
return;
user1:
# ---> monojackal cog
# set flame invisible and stop rotation
SetThingFlags(flame, 0x10);
SetThingLight(flame, '0 0 0', 0.0001, .01);
StopThing(flame);
# destroy flame2 and kindling (which removes sound and light from both)
DestroyThing(flame2);
StopSound(flamesound, 1);
DestroyThing(kindling);
# remove light from lightbox walls
SetThingLight(eyewall, '0 0 0', 0.001, .01);
SetThingLight(boxside0, '0 0 0', 0.001, .01);
SetThingLight(boxside1, '0 0 0', 0.001, .01);
SetThingLight(boxside2, '0 0 0', 0.001, .01);
return;
crossed:
# ---> TurnItOn and TurnItOff adjoins
if (GetSenderRef() == turniton)
{
# make glowing face transparent, add visibility to light channel
SetFaceGeoMode(glowface, 0);
SetSectorAdjoins(glowsector, 1);
# if puzzle is sprung, put light back on kindling
if (!GetThingFlags(flame) & 0x10)
{
SetThingLight(kindling, pyrlight0[pyrnum], 0.38, .1);
}
}
if (GetSenderRef() == turnitoff)
{
# take light off kindling (if flame visible), remove visibility from light channel
if (!GetThingFlags(flame) & 0x10)
{
SetThingLight(kindling, pyrlight0, 0.38, .1);
}
SetSectorAdjoins(glowsector, 0);
SetFaceGeoMode(glowface, 4);
}
return;
fixcams:
# reset camera settings
ResetCameraFOV(0, 0);
SetCameraPosInterp(2, 0);
SetCameraLookInterp(2, 0);
SetCameraPosInterp(1, 0);
SetCameraLookInterp(1, 0);
RestoreExtCam();
return;
end